import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import zhCN from './modules/zh'
import enUS from './modules/en'

export enum LanguageType {
  zhCN = 'zhCN',
  enUS = 'enUS'
}

export const resources = {
  [LanguageType.zhCN]: {
    translation: zhCN
  },
  [LanguageType.enUS]: {
    translation: enUS
  }
} as const

i18n.use(initReactI18next).init({
  lng: LanguageType.zhCN,
  resources,
  debug: false,
  interpolation: {
    escapeValue: false // not needed for react as it escapes by default
  }
})

export default i18n
